﻿@{
    ViewBag.Title = "体检结果同步系统";
}
@section scripts{
    <script type="text/javascript">
        function showLeftTime() {
            var now = new Date();
            var year = now.getFullYear();
            var month = now.getMonth() + 1;
            if (month < 10) {
                month = '0' + month;
            }
            var day = now.getDate();
            if (day < 10) {
                day = '0' + day;
            }
            var hours = now.getHours();
            if (hours < 10) {
                hours = '0' + hours;
            }
            //if (hours >= 9) {
            //    ScanTijian();
            //}
            var minutes = now.getMinutes();
            if (minutes < 10) {
                minutes = '0' + minutes;
            }
            var seconds = now.getSeconds();
            if (seconds < 10) {
                seconds = '0' + seconds;
            }
            var showTime = year + "年" + month + "月" + day + "日 " + hours + ":" + minutes + ":" + seconds + "";
            $('#nowTime').html(showTime);
            
        }

        window.onload = function () {
            setInterval("ScanTijian()", 300000);
            //ScanTijian();
            //一秒刷新一次显示时间
            setInterval(showLeftTime, 1000);
        };
        function ScanTijian() {
            $.ajax({
                type: "POST",
                url: "Home/ScanTijian?t=" + new Date().getTime(),//监控体检结果
                async: false,
                dataType: "json",
                contentType: "application/json; charset=utf-8",
                success: function (data) {
                    var objState = $.parseJSON(data.d);
                    console.log(objState.Message);
                }
            });

        }
    </script>
}
<div id="nowTime"></div>